package guo.enhanceAop;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.*;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

@Component
@Aspect
@Order(20)
public class LogAop {

    @Pointcut("execution(* guo.pojo.impl.*.*(..))")
    public void pc(){

    }

    @Before("pc()")
    public void preMethod(JoinPoint joinPoint){
        System.out.println("方法执行前执行");
    }

    @AfterReturning("pc()")
    public void postMethod(){
        System.out.println("方法正常执行后执行");
    }

    @After("pc()")
    public void finalyMethod(){
        System.out.println("方法一定执行");
    }

    @AfterThrowing("pc()")
    public void errorMethod(){
        System.out.println("方法报错执行");
    }

}
